Skip to content

allow titles to be string in various places #7262

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed

Conversation

archmoj
Copy link
Contributor

@archmoj archmoj commented Nov 5, 2024

Supersedes #7230 to simplify support and avoid adding this option via a deprecated attribute!
@plotly/plotly_js

Allow titles to be string, this includes:

  • layout titles and subtitles
  • cartesian axis titles
  • gl3d axis titles
  • polar axis titles
  • ternary axis titles
  • pie and funnelarea titles
  • colorbar titles
  • legend titles
  • shape titles
  • carpet titles
  • indicator titles

 - layout titles and subtitles
 - cartesian axis titles
 - gl3d axis titles
 - polar axis titles
 - ternary axis titles
 - pie and funnelarea titles
 - colorbar titles
 - legend titles
 - shape titles
 - carpet titles
 - indicator titles
@archmoj archmoj added P1 needed for current cycle feature something new labels Nov 5, 2024

afterEach(destroyGraphDiv);

it('still supports title-as-string', function(done) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove still

.then(done, done.fail);
});

it('can be updated using deprecated title-as-string', function(done) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove deprecated

@emilykl
Copy link
Contributor

emilykl commented Nov 5, 2024

@archmoj Should these tests be added in this branch? They are the only ones in my old branch which are not added here. #7230 (comment)

@emilykl
Copy link
Contributor

emilykl commented Nov 5, 2024

@archmoj I think I found a bug -- title text is showing up in the subtitle as well. Codepen: https://codepen.io/emilykl-code/pen/jOgvzGd

Screen Shot 2024-11-05 at 4 07 36 PM

@@ -1335,7 +1339,11 @@ plots.supplyLayoutGlobalDefaults = function(layoutIn, layoutOut, formatObj) {
coerce('title.y');
coerce('title.yanchor');

coerce('title.subtitle.text', layoutOut._dfltTitle.subtitle);
var subtitleIn = layoutIn.title;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@archmoj This must be the source of the bug -- should be layoutIn.title.subtitle

@archmoj
Copy link
Contributor Author

archmoj commented Nov 7, 2024

Closing in respect to @alexcjohnson's comment on slack:
"If it’s just about convenience I’m a little skeptical that it’s worth adding a special case for it, especially since then if you later want any extra styling you’ll have to also move the text - which may introduce weird breakages, like what happens if you have a string title and then call relayout to edit a style prop of the title? One or the other would get lost, I suspect."

@archmoj archmoj closed this Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature something new P1 needed for current cycle
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants